<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="/sinopac-fn" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" href="/sinopac/form/CSS/tabs.css">
		<script type="text/javascript" src="/sinopac/js/jQuery/jquery-1.8.2.min.js"></script>
		<script type="text/javascript" src="/sinopac/js/jQuery/jquery_DOMWindow.js"></script>
		<script type="text/javascript" src="/sinopac/js/tools/formUtil.js"></script>
<script>
	$(document).ready(function(){
		$('input[name=btnPrint]').click(function(){
			window.print();
		});
	});

	$(document).ready(function(){
		$('#token_esn').click(function(){
			var self = $(this);
			var voValue = self.attr('voValue');
			var form = $('#form1');
			form.prop('action', '${fn:url('/Index/chkCustId.action')}');
			form.append('<input type="hidden" name="function_num" value="4" />');
			form.append('<input type="hidden" name="token_esn" value="'+voValue+'" />');
			form.submit();
		});

		$('input[name=btnExcel]').click(function(){
			var f = $('#form1');
			f.prop('action','${fn:url('/LogQuery/exportExcel.action')}');
			f.submit();
		});
	});

	function exportToExcel() {
		var f = $('#form1');
		f.prop('action','${fn:url('/LogQuery/exportExcel.action')}');
		f.submit();
	}
</script>
<title>紀錄查詢</title>
</head>
<body>
<%@ include file="/form/include/title.jsp" %>
<s:form id="form1">
	<table width="800" align="center">
		<tr align="center"><td><h2><b>紀錄查詢</b></h2></td></tr>
		<tr align="center"><td><s:property value="record_str"/></td></tr>
	</table>
	<table class="table-style" align="center">
		<tr>
			<th>日期</th>
			<th>客戶ID</th>
			<th>TOKEN ESN</th>
			<th>異動項目</th>
			<th>異動結果</th>
			<th>異動經辦</th>
			<th>覆核主管</th>
			<th>註解</th>
		</tr>
		<s:iterator value="logList" status="c" var="cus">
			<tr>
				<td><s:property value="log_time"/></td>
				<td><s:property value="customer_id"/></td>
				<s:if test="%{token_esn != null}">
					<td><a id="token_esn" voValue="${token_esn}" href="#"><s:property value="token_esn"/></a></td>
				</s:if>
				<s:else>
					<td>未配發</td>
				</s:else>
				<td><s:property value="job_code"/></td>
				<td><s:property value="returncode"/></td>
				<td><s:property value="operator"/></td>
				<td><s:property value="manager"/></td>
				<td><s:property value="comment"/></td>
			</tr>
		</s:iterator>
	</table>
	<table width="800" align="center">
		<tr height="50"/>
		<tr align="center">
			<td ><s:submit action="backMain" theme="simple" value="確定"></s:submit></td>
			<td ><input type="button" name="btnPrint"value="列印"></td>
			<td ><input type="button" value="儲存" name="btnExcel" onclick="exportToExcel();"></td>
		</tr>
	</table>	
</s:form>
</body>
</html>